package com.sunplus.system.registration.controller.api;

import com.sunplus.common.core.controller.BaseController;
import com.sunplus.common.core.domain.AjaxResult;
import com.sunplus.system.registration.domain.PortalDictionaries;
import com.sunplus.system.registration.domain.PortalMouldField;
import com.sunplus.system.registration.param.MouldFieldParam;
import com.sunplus.system.registration.service.IPortalDictionariesService;
import com.sunplus.system.registration.service.IPortalMouldFieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 模板详情模板所需的字段信息Controller
 *
 * @author sunplus
 * @date 2021-03-25
 */
@RestController
@RequestMapping("/app/")
public class ApiPortalMouldFieldController extends BaseController {
    @Autowired
    private IPortalMouldFieldService portalMouldFieldService;
    @Autowired
    private IPortalDictionariesService portalDictionariesService;

    /**
     * 查询模板详情模板所需的字段信息列表
     */
    @PostMapping("mouldfield/marriage/list")
    public AjaxResult mouldFieldMarriageList(MouldFieldParam mouldFieldParam) {
        List<PortalMouldField> list = portalMouldFieldService.selectMarriageMouldFieldListByIdentity(mouldFieldParam);
        return AjaxResult.success(list);
    }
    @PostMapping("mouldfield/adoption/list")
    public AjaxResult mouldFieldAdoptionList(MouldFieldParam mouldFieldParam) {
        List<PortalMouldField> list = portalMouldFieldService.selectAdoptionMouldFieldListByIdentity(mouldFieldParam);
        return AjaxResult.success(list);
    }

    /**
     * 获取身份类别列表
     */
    @GetMapping("dictionaries/list")
    public AjaxResult dictionariesList() {
        List<PortalDictionaries> list = portalDictionariesService.findListBySupCode("sflb");
        return AjaxResult.success(list);
    }

}
